/**   
*  This file is part of WaterfallDisplay.
    
*  WaterfallDisplay is free software: you can redistribute it and/or modify   
*  it under the terms of the GNU General Public License as published by   
*  the Free Software Foundation, either version 3 of the License, or   
*  (at your option) any later version.
     
*  WaterfallDisplay is distributed in the hope that it will be useful,   
*  but WITHOUT ANY WARRANTY; without even the implied warranty of   
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   
*  GNU General Public License for more details.
   
*  See <http://www.gnu.org/licenses/>.

*/  
package waterfall;

import javafx.beans.property.SimpleStringProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;

/**
 * Pop up window for text input
 * 
 * @author altug.uzunali
 *
 */
public class TextEntry extends StackPane {
	
	private SimpleStringProperty textProperty;
	private TextField textField;
	
	public TextEntry() {
		super();
		textProperty = new SimpleStringProperty("");
		VBox vbox = new VBox(5);
		vbox.setStyle("-fx-background-color: gray;");
		Label label = new Label("Enter text");
		textField = new TextField();
		textField.setOnAction(new EventHandler<ActionEvent>() {
			
			@Override
			public void handle(ActionEvent arg0) {
				textProperty.set(textField.getText());
			}
		});
		vbox.getChildren().addAll(label, textField);
		getChildren().add(vbox);
	}
	
	public SimpleStringProperty textProperty() {
		return textProperty;
	}
	
	public void resetText() {
		textField.setText("");
	}

}
